<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title></title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->


<script type="text/javascript">
	function doEditor() {
		var selectRows = $("#dg").datagrid("getSelections");
		alert(selectRows);
		/* window.location.href = "${pageContext.request.contextPath}/admin/essay_Essayfind.action?essay.id="
				+ id; */
	}
	function doDelete(id) {
		if (window.confirm('你确认需要删除吗？')) {
			window.location.href = "${pageContext.request.contextPath}/admin/essay_EssayDelete.action?essay.id="
					+ id;
		} else {

		}

	}
	function refresh()
	{
		if (window.confirm('你确认需要刷新缓存吗？')) {
			window.location.href = "${pageContext.request.contextPath }/SystemRefresh.action";
			alert("刷新成功!");
		} else {

		}
	}
</script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/easyUI/jquery-1.8.2.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/easyUI/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="js/easyUI/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/js/easyUI/themes/icon.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/easyUI/easyui-lang-zh_CN.js"></script>
</head>

<body>

	<a href="javascript:refresh()">刷新系统缓存</a>
	<table id="dg">

	</table>
	<!-- <div>
		<a href="javascript:openBlogModifyTab()" class="easyui-linkbutton"
			iconCls="icon-edit">修改</a> <a href="javascript:deleteEssay()"
			class="easyui-linkbutton" iconCls="icon-remove">删除</a>
	</div> -->
	<script type="text/javascript">
		$('#dg')
				.datagrid(
						{
							url : "${pageContext.request.contextPath}/admin/JsonAction.action?time="
									+ new Date().getTime(),
							columns : [ [ {
								field : 'cb',
								checkbox : true
							},

							{
								field : 'id',
								title : '编号',
								width : 100
							}, {
								field : 'ename',
								title : '姓名',
								width : 100
							}, {
								field : 'date',
								title : '发布日期',
								width : 100
							}, {
								field : 'summary',
								title : '简介',
								width : 100
							}, {
								field : 'clickHit',
								title : '点击数',
								width : 100
							},

							] ],
							toolbar : [
									{
										iconCls : 'icon-edit',
										handler : function() {
											var selectRows = $("#dg").datagrid(
													"getSelections");
											if(selectRows.length==0)
											{
												alert("系统提示:请选择要编辑的的行数");
											}
											window.location.href = "${pageContext.request.contextPath}/admin/essay_Essayfind.action?essay.id="+ selectRows[0].id;
										}
									}, '-', {
										iconCls : 'icon-remove',
										handler : function() {
											var selectRows = $("#dg").datagrid("getSelections");
											if(selectRows.length==0)
											{
												alert("系统提示:请选择要删除的的行数");
											}
											else
											{
												if(window.confirm('你确认需要删除吗？'))
												{
													window.location.href = "${pageContext.request.contextPath}/admin/essay_EssayDelete.action?essay.id="+ selectRows[0].id;
												}
												else
												{
												}
											}
										}
									} ],
							singleSelect : true,
							fitColumns : true,
							pagination : true,
							pageNumber : 1,
							pageSize : 4,
							pageList : [ 4 ],
						});
	</script>
</body>
</html>
